package beanstao.util.type.base;

import java.util.Collection;

import beanstao.util.exception.technical.util.reflect.FailToCastObjectException;
import beanstao.util.type.Castor;
import beanstao.util.type.Castors;

@SuppressWarnings({ "rawtypes" })
public class Collection2Object extends Castor<Collection, Object>
{

	@Override
	public Object cast(Collection src, Class<?> toType, String... args) throws FailToCastObjectException
	{
		if (src.size() == 0)
			return null;
		return Castors.me().castTo(src.iterator().next(), toType);
	}

}
